"""
URL configuration for Xinjiaowu_Crm project.

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/5.1/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from xtuser.views import userlist, UserCreateView, UserDeleteView, UserUpdateView
from qxcrm_index.views import login_view, logout_view, home
from KeHu.views import kehulist, KeHuCreateView, KehuDeleteView, KehuUpdateView, KehuDetail,KeHuZilaoCreateOrUpdate,genjinlogsDeleteView,kehudingdanDeleteView
from ChanPin.views import 产品列表,ChanpinCreateView

urlpatterns = [
    path('login/', login_view, name='login'),
    path('logout/', logout_view, name='logout'),
    path('', home, name='home'),

    # path("", userlist.as_view(), name="index"),
    path('admin/', admin.site.urls),
    path("userlist/", userlist.as_view(), name="userlist"),
    path("adduser/", UserCreateView.as_view(), name="User_Create"),
    path('userlist/<int:pk>/delete/', UserDeleteView.as_view(), name='user_delete'),
    path('userlist/<int:pk>/up/', UserUpdateView.as_view(), name='user_up'),
    ####################### 客户
    path("kehulist/", kehulist.as_view(), name="kehu_list"),# 客户列表
    path("addkehu/", KeHuCreateView.as_view(), name="Kehu_Create"),# 添加客户
    path('kehu/<int:pk>/delete/', KehuDeleteView.as_view(), name='kehu_delete'),
    path('kehu/<int:pk>/detail/', KehuDetail.as_view(), name='Kehu_detail'),# 客户详情
    path('kehu/<int:pk>/update/', KehuUpdateView.as_view(), name='kehu_update'),# 客户更新
    path('kehu/<int:pk>/zilao/', KeHuZilaoCreateOrUpdate.as_view(), name='kehu_zilao_create_or_update'),# 添加客户子表{客户资料}
    path('kehu/log/<int:pk>/del/', genjinlogsDeleteView.as_view(), name='genjinlogs_delete'),#删除客户子表{客户更进记录}
    path('kehu/dingdan/<int:pk>/del/', kehudingdanDeleteView.as_view(), name='genjinlogs_delete'),#删除客户子表{删除客户订单}
    ######################产品
    path("productlist/", 产品列表.as_view(), name="product_list"),
    path("addproduct/", ChanpinCreateView.as_view(), name="Product_Create"),
]

from django.conf import settings
from django.conf.urls.static import static
if settings.DEBUG:
    urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)